#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QWidget>
#include "map.h"
#include "cube.h"

#include <QPainter>
#include <QTimer>
#include <QKeyEvent>
#include <QPolygon>
#include <QDebug>
#include <QFont>
#include <QFontDatabase>

#include <iostream>
#include "math.h"
using namespace std;

class Map;

namespace Ui {
    class MainWindow;
}

class MainWindow : public QWidget
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    MainWindow(QWidget *parent = 0, QString newFilepath = "", QString gameFile = "");
    ~MainWindow();


    //QString getFilepath() { return filepath; }
    //void setFilepath(QString newPath) { filepath = newPath; }

    void paintEvent(QPaintEvent *event);

    void keyPressEvent(QKeyEvent *event);
    void keyReleaseEvent(QKeyEvent *event);

    QImage shipFile();

private:
    Ui::MainWindow *ui;
    Map *gameMap;
    QString filepath;
    QImage bg, ship01, ship02, ship03, ship04, ship05, ship06, ship07, ship08, ship09;
    QTimer *gameTimer;
    int counter;
    QFont *speedFont;
    bool invertUpDown;
    bool cheatMode;

signals:
     void shipCrashed();
     void timerStart();

 private slots:
     void incCounter();
     void endGame();

};

#endif // MAINWINDOW_H
